package com.briup.bms.service.impl;

import com.briup.bms.bean.SInventory;
import com.briup.bms.dao.SInventoryMapper;
import com.briup.bms.service.SInventoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: Paocha
 * @date: 2021-11-23-13:28
 */
@Service
public class InventoryServiceImpl implements SInventoryService {
    @Autowired
    SInventoryMapper inventoryMapper;
    @Override
    public PageInfo<SInventory> selectByPageHepler(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SInventory> inventoryList = inventoryMapper.selectAll();
        return new PageInfo<>(inventoryList);
    }

    @Override
    public PageInfo<SInventory> selectByCondition(int pageNum, int pageSize, Integer wareHouseId, Integer productId) {
        PageHelper.startPage(pageNum,pageSize);
        List<SInventory> inventoryList = inventoryMapper.selectByCondition(wareHouseId,productId);
        return new PageInfo<>(inventoryList);
    }
}
